var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("EventData"),
    i = t("SpriteLoad"),
    s = t("ConfS"),
    c = t("fightManager"),
    l = require("./建筑挨打变色"),
    u = cc._decorator,
    p = u.ccclass,
    f = u.property,
    d = (function(t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (
                (e.box = null),
                (e.pbox = null),
                (e.sload = null),
                (e.hp = new a.default(1)),
                (e.maxhp = new a.default(1)),
                e
            );
        }
        return (
            n(e, t),
            (e.prototype.onEnable = function() {
                (this.npcdata = s.DatasManager.NPCDatasById[this.data.xueliang]),
                (this.maxhp.value = this.npcdata.hp),
                (this.hp.value = this.npcdata.hp),
                (this.pbox.size = cc.size(this.data.daxiao[0], this.data.daxiao[1])),
                this.pbox.apply(),
                    (this.box.size = cc.size(this.data.daxiaohit[0], this.data.daxiaohit[1])),
                    (this.node.width = this.box.size.width),
                    (this.node.height = this.box.size.height),
                    (this.sload.node.x = this.data.chushi[0]),
                    (this.sload.node.y = this.data.chushi[1]),
                    (this.sload.url.value = this.data.PicID);
            }),
            (e.prototype.on被攻击 = function(t) {
                var e = (t.skill.buff.baifenbi[0] / 100) * this.maxhp.value;
                (e = Math.ceil(e)),
                (this.hp.value -= e),
                this.manager.fight.dotValue.add(
                        this.node.x + this.data.piaozi[0],
                        this.node.y + this.data.piaozi[1],
                        e, !1, !1
                    ),
                    this.hp.value <= 0 ?
                    (t.body.addmp(this.data.Killnengliang),
                        this.manager.add_build_ruins(this, t.body == c.default.inst.player),
                        t.body == c.default.inst.player &&
                        c.default.inst.dotValue.addmp(
                            this.node.x + this.data.nengliangpiao[0],
                            this.node.y + this.data.nengliangpiao[1],
                            this.data.Killnengliang
                        ),
                        c.default.inst.分数和状态变化(t.body, s.DatasManager.PVP拆房子得分)) :
                    this.getComponent(l.default).do挨打变色();
            }),
            r([f(cc.BoxCollider)], e.prototype, "box", void 0),
            r([f(cc.PhysicsBoxCollider)], e.prototype, "pbox", void 0),
            r([f(i.default)], e.prototype, "sload", void 0),
            (e = r([p], e))
        );
    })(cc.Component);
o.default = d;